*Replication Material: Dofile for JLC article by Means and Unah (2025)

*only black and white respondents are in the sample

tab race
keep if race==1 | race==2
tab race
label values race race2
label define race2 1 "White Respondents" 2 "Black Respondents"
tab race

*Create dichotomous variables for respondent's race
generate resprace = .
replace resprace = 0 if (race==1)
replace resprace = 1 if (race==2)
tab resprace
label values resprace resprace2
label define resprace2 0 "White Respondents" 1 "Black Respondents"
tab resprace
*resprace (0 = white; 1 = black) 

*****Clean up dependent variables
**Williams - Render an unfair decision 
tab DKA310
*drop missing data from this DV
drop if DKA310==8

**Williams - Render an unfair decision in a racial discrimination and/or an affirmative action case 
tab DKA318 
*drop missing data from this DV
drop if DKA318==8

**Rescale DVS so that higher scores means more likely to decide case unfairly 
recode DKA310 5=1 4=2 2=4 1=5
recode DKA318 5=1 4=2 2=4 1=5
*now ranges from not likely at all (1) --> extremely likely (5) to render an unfair decision
*DKA310 --> Extremely likely to render an unfair decision
*DKA318 --> Extremely likely to make an unfair decision in a racial discrimination and affirmative action 

*Rename DVs
tab DKA310
generate unfair = DKA310
label values unfair unlbl
label define unlbl 1 "Not likely at all" 2 "Not too likely" 3 "Somewhat likely" 4 "Very likely" 5 "Extremely likely"
tab unfair 

tab DKA318
generate unfairrace = DKA318
label values unfairrace unrclbl
label define unrclbl 1 "Not likely at all" 2 "Not too likely" 3 "Somewhat likely" 4 "Very likely" 5 "Extremely likely"
tab unfairrace 

*****Clean up independent variables 
*Descriptive statistics for experimental conditions -- # within each treatment
*control
tab DKA308

*CREATE Treatment VARIABLE FOR BLACK JUDGE versus WHITE JUDGE
tab DKA308
generate blackjudges = .
replace blackjudges = 0 if (DKA308_treat== 4 | DKA308==5)
replace blackjudges = 1 if (DKA308_treat== 2 | DKA308==3)

*CREATE Treatment VARIABLE FOR WHITE JUDGE versus BLACK JUDGE
tab DKA308
generate whitejudges = .
replace whitejudges = 1 if (DKA308_treat== 4 | DKA308==5)
replace whitejudges = 0 if (DKA308_treat== 2 | DKA308==3)

**Label values for Black and White Judges Stimuli
label values blackjudges bjlbl
label define bjlbl 0 "White Judge" 1 "Black Judge", replace
tab blackjudges

label values whitejudges wjlbl
label define wjlbl 0 "Black Judge" 1 "White Judge" , replace
tab whitejudges

*Ensure that randomization of treatment works 
ttest race, by (blackjudges)
ttest gender, by (blackjudges)
ttest ideo5, by (blackjudges)
ttest pid3, by (blackjudges)
ttest educ, by (blackjudges)
ttest faminc, by (blackjudges)
*nothing should be statistically significant. If it is, you'll need to control for it. All good!

*create the age and age-squared variables 
generate age = 2014-birthyr
tab age 
*Youngest person is 18, oldest is 85 
generate age2 = age*age
tab age2 

tab gender 
tab educ 
tab black
tab ideo5
tab pid3
tab faminc
tab age 
tab age2

*fixing the partisanship variable 
tab pid3
gen partisanship=. 
replace partisanship=-1 if pid3==1
replace partisanship=0 if pid3==3
replace partisanship=1 if pid3==2
label values partisanship partisanshiplab
label define partisanshiplab -1 "Democrat" 0 "Independent" 1 "Republican"
tab partisanship

*fixing the ideology variable
gen ideo5ptscale=.
replace ideo5ptscale=0 if ideo5==1 
replace ideo5ptscale=1 if ideo5==2
replace ideo5ptscale=2 if ideo5==3
replace ideo5ptscale=3 if ideo5==4
replace ideo5ptscale=4 if ideo5==5

label values ideo5ptscale ideo5lab
label define ideo5lab 0 "Very Liberal" 1 "Liberal" 2 "Moderate" 3 "Conservative" 4 "Very Conservative"
tab ideo5ptscale

*racial resentment control variables
tab CC422a
tab CC422b

generate CC422anew = CC422a
recode CC422anew 8=.
tab CC422anew

label values CC422anew CC422anewlab
label define CC422anewlab 1 "Strongly agree" 2 "Somewhat agree" 3 "Neither agree nor disagree" 4 "Somewhat disagree" 5 "Strongly disagree"
tab CC422anew

generate CC422bnew = CC422b
recode CC422bnew 8=.
recode CC422bnew 5=1 4=2 2=4 1=5
label values CC422bnew CC422bnewlab
label define CC422bnewlab 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
tab CC422bnew

generate racialresentment = CC422anew + CC422bnew 
tab racialresentment

**********Table 1: Descriptive & Summary Statistics
*Descriptive and summary statistics for dependent varaibles
*Black respondents = resprace==1
tab unfair if resprace==1
summarize unfair if resprace==1

tab unfairrace if resprace==1
summarize unfairrace if resprace==1

*White respondents = resprace==0
tab unfair if resprace==0
summarize unfair if resprace==0

tab unfairrace if resprace==0 
summarize unfairrace if resprace==0

*Descriptive & summary statistics for independent variables
*percentage and number of respondents who received which treatment/stimuli
tab blackjudges

*percentage and number of respondents who were women
tab gender 

*percentage and number of respondents at the various education levels
tab educ 

*percentage and number of respondents who were black and white
tab resprace

*percentage and number of respondents at the various levels of ideology
tab ideo5

*percentage and number of respondents at the various levels of partisanship
tab pid3

*percentage and number of respondents at the various levels of family income
tab faminc

* average age of respondent, and percentage and number of respondents at the various ages
summarize age
tab age 

*average score on racial resentment, and percentage and number of respondents at various levels of racial resentment
tab racialresentment

******DATA ANALYSIS***********
**********T-TESTS**********
**Unfair DV
ttest unfair if resprace==0, by (blackjudges)
ttest unfair if resprace==1, by (blackjudges)
*For white respondents, there is no statistically significant difference in their perception of black and white judges' likelihood of being unfair in court cases/decisions.
*But for black respondents, there is a statistically significant difference in their perception of black and white judges' likelihood of being unfair in court cases/decisions.
*Black respondents who received the white judge treatment, viewed the white judge as being much more likely to render an unfair decision 
//than black respondents who received the black judge treatment. 
 
**Unfair in race-related cases DV
ttest unfairrace if resprace==0, by (blackjudges)
ttest unfairrace if resprace==1, by (blackjudges)
*For white respondents, there is no statistically significant difference in their perception of black and white judges' likelihood of being unfair in race-related cases. 
*This is specifically testing Derrick Bell's assertion that black judges do not have the capacity to be fair in racialized cases. The data does not support Bell's view. 
*For black respondents, there is a statistically significant difference in their perception of black and white judges' likelihood of being unfair in racialized cases. 
*Black respondents who received the white judge treatment, viewed the white judge as being much more likely to render an unfair decision 
//than black respondents who received the black judge treatment. 

*The following four TTESTS are comparing the mean level of perception that the judge would decide a case (generally or race-related) unfairly
ttest unfair if blackjudges==1, by (resprace)
*This TTEST reveals there is no significant difference in how black and white respondents view black judges when it comes to perceiving judges being unfair generally*

ttest unfairrace if blackjudges==1, by (resprace)
*This TTEST reveals there is no significant difference in how black and white respondents view black judges when it comes to perceiving judges being unfair in cases concerning race*

ttest unfair if blackjudges==0, by (resprace)
*This TTEST reveals there is a statistically significant difference in how black and white respondents view white judges when it comes to perceiving judges being unfair generally*
*Black respondents view the white judge as being more likely to be unfair

ttest unfairrace if blackjudges==0, by (resprace)
*This TTEST reveals there is a statistically significant difference in how black and white respondents view white judges when it comes to perceiving judges being unfair in cases concerning race*
*Black respondents view the white judge as being more likely to be unfair

***Graphs with mean level of perception of unfairness in general cases and race-related cases
**4.25 by 7.5 (graph size)
*Figures 1 and 2 are comparing how black respondents view black judges vs. white judges, and how white respondents view black vs. white judges
*Figure 1 is expimental stimuli* done

*Figure 2: done
* Mean Level of Unfairness in Unspecified Cases by Race of Judge (Race of Respondnet)
graph bar (mean) unfair, over (blackjudges) over (resprace) blabel (bar, format (%4.2f)) ylabel (0(1)5) ytitle ("Mean of Perception of Judges'" "Likelihood to Decide Unspecified Cases Unfairly") bar (1, bcolor (black)) bar (2, bcolor (black)) bar (3, bcolor (black)) bar (4, bcolor (black))

*graph bar (mean) unfair, over(blackjudges, relabel(1 "black" 0 "white")) over(resprace, relabel(1 "black" 0 "white"))  
 
*Mean Level of Unfairness in Race-related Cases by Race of Judge (Race of Respondnet)
graph bar (mean) unfairrace, over (blackjudges) over (resprace) blabel (bar, format (%4.2f)) ylabel (0(1)5) ytitle ("Mean of Perception of Judges'" "Likelihood to Decide Race-related Cases Unfairly") bar (1, bcolor (black)) bar (2, bcolor (black)) bar (3, bcolor (black)) bar (4, bcolor (black))

*Figures 3 done
*comparing how black and white respondents view black judges vs. white judges 
*Mean Level of Unfairness in Unspecified Cases by Race of Respondnet (Race of Judge)
graph bar (mean) unfair, over (resprace) over (blackjudges)  blabel (bar, format (%4.2f)) ylabel (0(1)5) ytitle ("Mean of Perception of Judges'" "Likelihood to Decide Unspecified Cases Unfairly") bar (1, bcolor (black)) bar (2, bcolor (black)) bar (3, bcolor (black)) bar (4, bcolor (black))

*Mean Level of Unfairness in Race-related Cases by Race of Respondent (Race of Judge)
graph bar (mean) unfairrace, over (resprace) over (blackjudges)  blabel (bar, format (%4.2f)) ylabel (0(1)5) ytitle ("Mean of Perception of Judges'" "Likelihood to Decide Race-relate Cases Unfairly") bar (1, bcolor (black)) bar (2, bcolor (black)) bar (3, bcolor (black)) bar (4, bcolor (black))

*Special Note: BECAUSE WE NEED ERROR BARS/CIs, WE CONSTRUCTED THESE FIGURES IN EXCEL 
*USING INFORMATION FROM T-TEST ANALYSIS IN STATA 


**********BASIC OLS REGRESSIONS********************
*Appendix A (Table). Perception of the Likelihood that a Judge would be Unfair 
*and
*FIGURE 4 PANEL A.
****BASIC OLS REGRESSION for white respondents perception of Black judges for both DVs****

regress unfair blackjudges if resprace==0, robust
estimates store A
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(Logistic Reg Coef Est) name(Modela1, replace)

regress unfairrace blackjudges if resprace==0, robust
estimate store B
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(Logistic Reg Coef Est) name(Modela2, replace)
coefplot (A, label(Black Judges, White Resp unfair) pstyle(p3) offset(0.15)) (B, label(Blk Jud, Wht resp unfairrace) pstyle(p4) offset(-0.15)), msymbol(S) drop(_cons) xline(0)

*FIGURE 4 PANEL B. Note that regression estimates are reported in Appendix C as well.
**BASIC OLS REGRESSION for black respondents' perception of Black Judges for both DVs**
regress unfair blackjudges if resprace==1
estimate store C
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(Logistic Reg Coef Est) name(Modela3, replace)
 
regress unfairrace blackjudges if resprace==1
estimate store D
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(Logistic Reg Coef Est) name(Modela4, replace)

graph combine Modela3 Modela4
coefplot (C, label(Blk Jud, Blk Resp unfair) pstyle(p3) offset(0.15)) (D, label(Blk Jud, Blk resp unfairrace) pstyle(p4) offset(-0.15)), msymbol(S) drop(_cons) ci(95) xline(0)

*NOTE THAT THE DEFAULD CONFIDENCE INTERVAL LEVEL IS 95% IF CI IS NOT SPECIFIED

*Figure 5 Panel A*
regress unfair gender educ liberal conservatives faminc age age2 racialresentment if resprace==1 & blackjudges==0, robust 
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(ModelC Logistic Reg unfair Blk resp wht jud)name(ModelC, replace)
estimates store M
regress unfair gender educ liberal conservatives faminc age age2 racialresentment if resprace==1 & blackjudges==1, robust 
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(ModelD Logistic Reg unfair Blk resp Blk jud)name(ModelD, replace)
estimates store N
coefplot (M, label(White Judges) pstyle(p3) offset(0.1)) (N, label(Black Judges) pstyle(p4) offset(-0.1)), msymbol(S) drop(_cons) xline(0)

*FIGURE 5 PANEL B
regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment if resprace==1 & blackjudges==0, robust 
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(ModelC Logistic Reg unfair Blk resp wht jud)name(ModelC, replace)
estimates store Q
regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment if resprace==1 & blackjudges==1, robust 
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(ModelD Logistic Reg unfair Blk resp Blk jud)name(ModelD, replace)
estimates store R
coefplot (Q, label(White Judges) pstyle(p3) offset(0.1)) (R, label(Black Judges) pstyle(p4) offset(-0.1)), msymbol(S) drop(_cons) xline(0)

*Figure 6 PANEL A
regress unfair gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==0, robust 
estimates store O
regress unfair gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==1, robust 
estimates store P
coefplot (O, label(White Judges) pstyle(p3) offset(0.1)) (P, label(Black Judges) pstyle(p4) offset(-0.1)), msymbol(S) drop(_cons) xline(0)

*Figure 6 PANEL B 
regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==0, robust 
estimates store O
regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==1, robust 
estimates store P
coefplot (O, label(White Judges) pstyle(p3) offset(0.1)) (P, label(Black Judges) pstyle(p4) offset(-0.1)), msymbol(S) drop(_cons) xline(0)


*FIGURE 7 PANEL A.
regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==0, robust 
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(Model 2 Logistic Regression Coefficient Estimate)name(Model2, replace)
margins, at(racialresentment=(0(1)10) ) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 

*FIGURE 7 PANEL B
regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==1, robust 
coefplot, drop (_cons) ci(90) xline(0) grid(none) xtitle(Model 2 Logistic Regression Coefficient Estimate)name(Model2, replace)
margins, at(racialresentment=(0(1)10) ) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 


*FIGURE 8 PANEL A
regress unfairrace obama_approval if resprace==1 & blackjudges==1, robust 
margins, at(obama_approval=(1(1)4) ) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 

*FIGURE 8 PANEL B 
regress unfair obama_approval if resprace==1 & blackjudges==1, robust 
margins, at(obama_approval=(1(1)4) ) atmeans vsquish post
marginsplot, recast(scatter) name(modB, replace) 


*hypothical case
*APPENDIX B1
*Black respondents in traffic and airline regulation cases
regress airline gender educ liberal conservatives faminc age age2 racialresentment if resprace==1 & blackjudges==0, robust 
estimates store O
regress airline gender educ liberal conservatives faminc age age2 racialresentment if resprace==1 & blackjudges==1, robust 
estimates store P
coefplot (O, label(White Judges) pstyle(p3) offset(0.1)) (P, label(Black Judges) pstyle(p4) offset(-0.1)), msymbol(S) drop(_cons) xline(0)

*APPENDIX B2
*white repondents in traffic and airline regulation cases
regress airline gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==0, robust 
estimates store O
regress airline gender educ liberal conservatives faminc age age2 racialresentment if resprace==0 & blackjudges==1, robust 
estimates store P
coefplot (O, label(White Judges) pstyle(p3) offset(0.1)) (P, label(Black Judges) pstyle(p4) offset(-0.1)), msymbol(S) drop(_cons) xline(0)


*UNFAIR
*APPENDIX C1
regress unfair gender educ liberal conservatives faminc age age2 racialresentment resprace if DKA308_treat==2
coefplot,  ci(90) xline(0) grid(none) xtitle(Logistic Reg White resp black female judges)name(Model2a, replace)
estimates store J
margins, at(racialresentment=(0(1)10)) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 

regress unfair gender educ liberal conservatives faminc age age2 racialresentment resprace if DKA308_treat==3
coefplot, ci(90) xline(0) grid(none) xtitle(Logistic Reg White resp black male judges)name(Model2b, replace)
estimates store K
margins, at(racialresentment=(0(1)10) ) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 
coefplot (J, label(Black Women Judges) pstyle(p3) offset(0.1)) (K, label(Black Male Judges) pstyle(p4) offset(-0.1)), msymbol(S) xline(0)

*UNFAIRRACE
*APPENDIX C2

regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment resprace if DKA308_treat==2
coefplot,  ci(90) xline(0) grid(none) xtitle(Logistic Reg White resp black female judges)name(Model2a, replace)
estimates store J
margins, at(racialresentment=(0(1)10) ) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 

regress unfairrace gender educ liberal conservatives faminc age age2 racialresentment resprace if DKA308_treat==3
coefplot, ci(90) xline(0) grid(none) xtitle(Logistic Reg White resp black male judges)name(Model2b, replace)
estimates store K
margins, at(racialresentment=(0(1)10) ) atmeans vsquish post
marginsplot, recast(scatter) name(mod1, replace) 
coefplot (J, label(Black Women Judges) pstyle(p3) offset(0.1)) (K, label(Black Male Judges) pstyle(p4) offset(-0.1)), msymbol(S) xline(0)

*All other graphs reported in the appendix were generated in a similar manner.


*DKA308 is coded thusly:
*1=control
*2=black women
*3=black men
*4=white women
*5=white men


*HERE IS THE COMMAND TO INSTALL THE COEFPLOT SYNTAX
"ssc install coefplot, replace"

*RUN DESCRIPTIVE STATISTICS FOR ALL VARIABLES USED IN ANALYSIS
sum blackjudges gender educ liberal conservatives faminc age age2 racialresentment

*END OF CODE






